home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
LOGIC Apps
/
Logic-APPLE_II_APPS.iso
/
pc
/
LOGIC Apple II 5.25" Library - DOS Part 2
/
DOS036.dsk
/
CALC1.int
< prev
next >
Wrap
Text File
|
2012-02-16
|
2KB
|
80 lines
5 DIM A$(40),B(40),B$(40)
10 D$="<CTRL-D>"
15 K=-1
20 CALL 2073:CALL 2173
50 CALL -936
55 PRINT "THE TALKING CALCULATOR BY ROGER KEATING":PRINT
60 PRINT "THE CHARACTERS YOU CAN USE ARE"
70 PRINT
75 PRINT "32767 MAXIMUM - INTEGER ARITHMETIC":PRINT
80 PRINT "0123456789 + * / - = (ESC TO FINISH)"
90 POKE 34,12
100 CALL -936
105 A=0:B=0:I=0
110 X= PEEK (-16384):IF X<127 THEN 110
120 POKE -16368,0
125 IF X=155 THEN 32000
130 IF X<170 OR X>189 THEN 110
140 IF X=172 OR X=174 OR X=186 OR X=187 OR X=188 THEN 110
150 IF X=189 THEN 1000
160 IF X<176 OR X>185 THEN 200
170 PRINT X-176;
172 K=1
175 E=X-175: POKE 6,E:CALL 2054
180 A=10*A+(X-176)
190 GOTO 110
200 IF K>0 THEN 209
201 IF K=-1 AND X=171 THEN 209
202 IF K=-1 AND X=173 THEN 209
206 PRINT "<CTRL-G><CTRL-G><CTRL-G>";:GOTO 110
209 I=I+1:B(I)=A:A=0:K=0
210 IF X#171 THEN 220:A$(I)="+":PRINT " + ";: POKE 6,11:CALL 2054
220 IF X#170 THEN 230:A$(I)="*":PRINT " * ";: POKE 6,12:CALL 2054
230 IF X#175 THEN 240:A$(I)="/":PRINT " / ";: POKE 6,14:CALL 2054
240 IF X#173 THEN 250:A$(I)="-":PRINT " - ";: POKE 6,13:CALL 2054
250 GOTO 110
1000 PRINT :PRINT :PRINT " = ";
1001 I=I+1:B(I)=A:A$(I)="=":K=1
1002 POKE 6,15:CALL 2054
1004 ANS=0:FOR N=1 TO I
1005 IF A$(N,N)="*" OR A$(N,N)="/" THEN 1010:GOTO 1050
1010 K=N:FOR T=N+1 TO I
1015 IF A$(T-1,T-1)="*" OR A$(T-1,T-1)="/" THEN 1020
1016 T=I:GOTO 1040
1020 IF A$(T-1,T-1)="*" THEN B(K)=B(K)*B(T)
1030 IF A$(T-1,T-1)="/" THEN B(K)=B(K)/B(T)
1035 N=N+1
1040 NEXT T
1050 NEXT N
1510 ANS=B(1)
1520 IF I=1 THEN 1800
1530 FOR N=1 TO I
1540 IF A$(N,N)="+" THEN ANS=ANS+B(N+1)
1550 IF A$(N,N)="-" THEN ANS=ANS-B(N+1)
1560 NEXT N
1800 IF ANS<0 THEN 1810
1801 IF ANS=0 THEN 1808
1802 POKE 6,11:CALL 2054
1803 GOTO 1850
1808 POKE 6,1:CALL 2054:PRINT 0:GOTO 2000
1810 POKE 6,13:CALL 2054
1840 PRINT "- ";
1845 ANS=-ANS
1850 W=ANS/10000:IF W=0 THEN 1860
1855 POKE 6,W+1:CALL 2054:PRINT W;
1860 ANS=ANS-W*10000
1870 W2=ANS/1000:IF W2=0 AND W=0 THEN 1900
1880 POKE 6,W2+1:CALL 2054:PRINT W2;
1900 ANS=ANS-W2*1000:W3=ANS/100:IF W3=0 AND W2=0 AND W=0 THEN 1930
1910 POKE 6,W3+1:CALL 2054:PRINT W3;
1930 ANS=ANS-W3*100:W4=ANS/10:IF W4=0 AND W3=0 AND W2=0 AND W=0 THEN 1950
1940 POKE 6,W4+1:CALL 2054:PRINT W4;
1950 ANS=ANS-10*W4: POKE 6,ANS+1:CALL 2054:PRINT ANS
2000 VTAB 20:PRINT "HIT ANY KEY TO CONTINUE."
2001 X= PEEK (-16384):IF X<127 THEN 2001
2002 POKE -1668,0:GOTO 50
32000 D$="<CTRL-D>"
32001 PRINT D$;"RUN MENU"
32002 PRINT D$;"RUN MENU"
32003 END